﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using csvformater.Gardgets;
using csvformater.config;
using csvformater.csvReader;

namespace csvformater
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        private List<TableSingleton> tableSingletons;
    	private const string newFileName = "新文件";
        public MainWindow()
        {
            InitializeComponent();
            InitializData();

        }

    	private void InitializData()
        {
            tableSingletons = new List<TableSingleton>();
            var tableSingleTon = new TableSingleton();
            tables.AddNewTab(newFileName, ref tableSingleTon);
            tableSingletons.Add(tableSingleTon);
        	var path = Configure.Read("Setting/Model/Path");
            var dt = NzCsvLoader.LoadCsv(path);
            var dataTable = dt.Tables[0];
			tableSingleTon.SetData(dataTable);
    	    var testData = new List<string>();
            testData.Add("货号");
            testData.Add("名称");
                               
    	    new Formater().Query(testData, dataTable);
        }      
    }
}
